#ifndef MOUSE_H
#define MOUSE_H

namespace Cvekas {

/// Represents mouse position in screen coordinates
struct MousePos
{
	int x, y;
	MousePos() : x(0), y(0) {}
	MousePos(int x, int y) : x(x), y(y) {}
};

/// %Mouse
class Mouse : public boost::noncopyable
{
public:
	/// Enumeration of supported mouse buttons
	enum MouseButton
	{
		BTN_LEFT = 0,
		BTN_RIGHT = 1,
		BTN_MIDDLE = 2
	};

	/// Constructor. You shouldn't call this, Input will provide access to Mouse
	Mouse();
	
	/// Destructor
	virtual ~Mouse();

	/// Refreshes mouse data. Must be called each frame
	void update();

	/// Returns true if MouseButton is being held down
	bool isButtonPressed(MouseButton b) const;
	/// Returns true if MouseButton was released
	bool isButtonUp(MouseButton b) const;
	/// Returns true if MouseButton was pressed
	bool isButtonDown(MouseButton b) const;

	/// Returns absolute mouse position. You can clamp return values by calling setAbsoluteBounds()
	MousePos getAbsolutePos() const;
			
	// TODO: Implement mouse wheel
	/// Returns relative mouse wheel movement
	int getRelativeWheel() const;

	/// Sets virtual resolution
	void setVirtualResolution(uint width, uint height) {v_width = width; v_height = height;};

	/// See Input::process()
	bool process(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

private:		
	bool mouse[3];
	bool mouse_current[3];
	bool mouse_last[3];

	MousePos mouse_pos, mouse_pos_old;
	uint v_width, v_height;
	uint r_width, r_height;
};

typedef boost::shared_ptr<Mouse> MousePtr;

} // namespace

#endif